/*
Copyright (C) 1997-2001 Id Software, Inc.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/
/*
** QGL_WIN.C
**
** This file implements the operating system binding of GL to QGL function
** pointers.  When doing a port of Quake2 you must implement the following
** two functions:
**
** QGL_Init() - loads libraries, assigns function pointers, etc.
** QGL_Shutdown() - unloads libraries, NULLs function pointers
*/
#define WIN32_LEAN_AND_MEAN
#define VC_LEANMEAN
#define QGL_EXTERN

#define QGL_FUNC(type,name,params) extern type (APIENTRY * q##name) params;
#define QGL_EXT(type,name,params) extern type (APIENTRY * q##name) params;
#define QGL_WGL(type,name,params) extern type (APIENTRY * q##name) params;
#define QGL_WGL_EXT(type,name,params) extern type (APIENTRY * q##name) params;

#include <windows.h>
#include <GL/gl.h>
#include "../qcommon/qcommon.h"
#include "../ref_gl/glext.h"

static GLvoid			(APIENTRY * dllAccum)(GLenum op, GLfloat value);
static GLvoid 			(APIENTRY * dllAlphaFunc)(GLenum func, GLclampf ref);
static GLboolean		(APIENTRY * dllAreTexturesResident)(GLsizei n, const GLuint *textures, GLboolean *residences);
static GLvoid 			(APIENTRY * dllArrayElement)(GLint i);
static GLvoid 			(APIENTRY * dllBegin)(GLenum mode);
static GLvoid 			(APIENTRY * dllBindTexture)(GLenum target, GLuint texture);
static GLvoid 			(APIENTRY * dllBitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
static GLvoid 			(APIENTRY * dllBlendFunc)(GLenum sfactor, GLenum dfactor);
static GLvoid 			(APIENTRY * dllCallList)(GLuint list);
static GLvoid 			(APIENTRY * dllCallLists)(GLsizei n, GLenum type, const GLvoid *lists);
static GLvoid 			(APIENTRY * dllClear)(GLbitfield mask);
static GLvoid 			(APIENTRY * dllClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
static GLvoid 			(APIENTRY * dllClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
static GLvoid 			(APIENTRY * dllClearDepth)(GLclampd depth);
static GLvoid 			(APIENTRY * dllClearIndex)(GLfloat c);
static GLvoid 			(APIENTRY * dllClearStencil)(GLint s);
static GLvoid 			(APIENTRY * dllClipPlane)(GLenum plane, const GLdouble *equation);
static GLvoid 			(APIENTRY * dllColor3b)(GLbyte red, GLbyte green, GLbyte blue);
static GLvoid 			(APIENTRY * dllColor3bv)(const GLbyte *v);
static GLvoid 			(APIENTRY * dllColor3d)(GLdouble red, GLdouble green, GLdouble blue);
static GLvoid 			(APIENTRY * dllColor3dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllColor3f)(GLfloat red, GLfloat green, GLfloat blue);
static GLvoid 			(APIENTRY * dllColor3fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllColor3i)(GLint red, GLint green, GLint blue);
static GLvoid 			(APIENTRY * dllColor3iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllColor3s)(GLshort red, GLshort green, GLshort blue);
static GLvoid 			(APIENTRY * dllColor3sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllColor3ub)(GLubyte red, GLubyte green, GLubyte blue);
static GLvoid 			(APIENTRY * dllColor3ubv)(const GLubyte *v);
static GLvoid 			(APIENTRY * dllColor3ui)(GLuint red, GLuint green, GLuint blue);
static GLvoid 			(APIENTRY * dllColor3uiv)(const GLuint *v);
static GLvoid 			(APIENTRY * dllColor3us)(GLushort red, GLushort green, GLushort blue);
static GLvoid 			(APIENTRY * dllColor3usv)(const GLushort *v);
static GLvoid 			(APIENTRY * dllColor4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
static GLvoid 			(APIENTRY * dllColor4bv)(const GLbyte *v);
static GLvoid 			(APIENTRY * dllColor4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
static GLvoid 			(APIENTRY * dllColor4dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
static GLvoid 			(APIENTRY * dllColor4fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllColor4i)(GLint red, GLint green, GLint blue, GLint alpha);
static GLvoid 			(APIENTRY * dllColor4iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllColor4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha);
static GLvoid 			(APIENTRY * dllColor4sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
static GLvoid 			(APIENTRY * dllColor4ubv)(const GLubyte *v);
static GLvoid 			(APIENTRY * dllColor4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha);
static GLvoid 			(APIENTRY * dllColor4uiv)(const GLuint *v);
static GLvoid 			(APIENTRY * dllColor4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha);
static GLvoid 			(APIENTRY * dllColor4usv)(const GLushort *v);
static GLvoid 			(APIENTRY * dllColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
static GLvoid 			(APIENTRY * dllColorMaterial)(GLenum face, GLenum mode);
static GLvoid 			(APIENTRY * dllColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
static GLvoid 			(APIENTRY * dllCopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
static GLvoid 			(APIENTRY * dllCopyTexImage1D)(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
static GLvoid 			(APIENTRY * dllCopyTexImage2D)(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
static GLvoid 			(APIENTRY * dllCopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
static GLvoid 			(APIENTRY * dllCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
static GLvoid 			(APIENTRY * dllCullFace)(GLenum mode);
static GLvoid 			(APIENTRY * dllDeleteLists)(GLuint list, GLsizei range);
static GLvoid 			(APIENTRY * dllDeleteTextures)(GLsizei n, const GLuint *textures);
static GLvoid 			(APIENTRY * dllDepthFunc)(GLenum func);
static GLvoid 			(APIENTRY * dllDepthMask)(GLboolean flag);
static GLvoid 			(APIENTRY * dllDepthRange)(GLclampd zNear, GLclampd zFar);
static GLvoid 			(APIENTRY * dllDisable)(GLenum cap);
static GLvoid 			(APIENTRY * dllDisableClientState)(GLenum array);
static GLvoid 			(APIENTRY * dllDrawArrays)(GLenum mode, GLint first, GLsizei count);
static GLvoid 			(APIENTRY * dllDrawBuffer)(GLenum mode);
static GLvoid 			(APIENTRY * dllDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
static GLvoid 			(APIENTRY * dllDrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
static GLvoid 			(APIENTRY * dllEdgeFlag)(GLboolean flag);
static GLvoid 			(APIENTRY * dllEdgeFlagPointer)(GLsizei stride, const GLvoid *pointer);
static GLvoid 			(APIENTRY * dllEdgeFlagv)(const GLboolean *flag);
static GLvoid 			(APIENTRY * dllEnable)(GLenum cap);
static GLvoid 			(APIENTRY * dllEnableClientState)(GLenum array);
static GLvoid 			(APIENTRY * dllEnd)(GLvoid);
static GLvoid 			(APIENTRY * dllEndList)(GLvoid);
static GLvoid 			(APIENTRY * dllEvalCoord1d)(GLdouble u);
static GLvoid 			(APIENTRY * dllEvalCoord1dv)(const GLdouble *u);
static GLvoid 			(APIENTRY * dllEvalCoord1f)(GLfloat u);
static GLvoid 			(APIENTRY * dllEvalCoord1fv)(const GLfloat *u);
static GLvoid 			(APIENTRY * dllEvalCoord2d)(GLdouble u, GLdouble v);
static GLvoid 			(APIENTRY * dllEvalCoord2dv)(const GLdouble *u);
static GLvoid 			(APIENTRY * dllEvalCoord2f)(GLfloat u, GLfloat v);
static GLvoid 			(APIENTRY * dllEvalCoord2fv)(const GLfloat *u);
static GLvoid 			(APIENTRY * dllEvalMesh1)(GLenum mode, GLint i1, GLint i2);
static GLvoid 			(APIENTRY * dllEvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
static GLvoid 			(APIENTRY * dllEvalPoint1)(GLint i);
static GLvoid 			(APIENTRY * dllEvalPoint2)(GLint i, GLint j);
static GLvoid 			(APIENTRY * dllFeedbackBuffer)(GLsizei size, GLenum type, GLfloat *buffer);
static GLvoid 			(APIENTRY * dllFinish)(GLvoid);
static GLvoid 			(APIENTRY * dllFlush)(GLvoid);
static GLvoid 			(APIENTRY * dllFogf)(GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllFogfv)(GLenum pname, const GLfloat *params);
static GLvoid 			(APIENTRY * dllFogi)(GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllFogiv)(GLenum pname, const GLint *params);
static GLvoid 			(APIENTRY * dllFrontFace)(GLenum mode);
static GLvoid 			(APIENTRY * dllFrustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
static GLuint			(APIENTRY * dllGenLists)(GLsizei range);
static GLvoid 			(APIENTRY * dllGenTextures)(GLsizei n, GLuint *textures);
static GLvoid 			(APIENTRY * dllGetBooleanv)(GLenum pname, GLboolean *params);
static GLvoid 			(APIENTRY * dllGetClipPlane)(GLenum plane, GLdouble *equation);
static GLvoid 			(APIENTRY * dllGetDoublev)(GLenum pname, GLdouble *params);
static GLenum			(APIENTRY * dllGetError)(GLvoid);
static GLvoid 			(APIENTRY * dllGetFloatv)(GLenum pname, GLfloat *params);
static GLvoid 			(APIENTRY * dllGetIntegerv)(GLenum pname, GLint *params);
static GLvoid 			(APIENTRY * dllGetLightfv)(GLenum light, GLenum pname, GLfloat *params);
static GLvoid 			(APIENTRY * dllGetLightiv)(GLenum light, GLenum pname, GLint *params);
static GLvoid 			(APIENTRY * dllGetMapdv)(GLenum target, GLenum query, GLdouble *v);
static GLvoid 			(APIENTRY * dllGetMapfv)(GLenum target, GLenum query, GLfloat *v);
static GLvoid 			(APIENTRY * dllGetMapiv)(GLenum target, GLenum query, GLint *v);
static GLvoid 			(APIENTRY * dllGetMaterialfv)(GLenum face, GLenum pname, GLfloat *params);
static GLvoid 			(APIENTRY * dllGetMaterialiv)(GLenum face, GLenum pname, GLint *params);
static GLvoid 			(APIENTRY * dllGetPixelMapfv)(GLenum map, GLfloat *values);
static GLvoid 			(APIENTRY * dllGetPixelMapuiv)(GLenum map, GLuint *values);
static GLvoid 			(APIENTRY * dllGetPixelMapusv)(GLenum map, GLushort *values);
static GLvoid 			(APIENTRY * dllGetPointerv)(GLenum pname, GLvoid* *params);
static GLvoid 			(APIENTRY * dllGetPolygonStipple)(GLubyte *mask);
static const GLubyte *	(APIENTRY * dllGetString)(GLenum name);
static GLvoid 			(APIENTRY * dllGetTexEnvfv)(GLenum target, GLenum pname, GLfloat *params);
static GLvoid 			(APIENTRY * dllGetTexEnviv)(GLenum target, GLenum pname, GLint *params);
static GLvoid 			(APIENTRY * dllGetTexGendv)(GLenum coord, GLenum pname, GLdouble *params);
static GLvoid 			(APIENTRY * dllGetTexGenfv)(GLenum coord, GLenum pname, GLfloat *params);
static GLvoid 			(APIENTRY * dllGetTexGeniv)(GLenum coord, GLenum pname, GLint *params);
static GLvoid 			(APIENTRY * dllGetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
static GLvoid 			(APIENTRY * dllGetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat *params);
static GLvoid 			(APIENTRY * dllGetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params);
static GLvoid 			(APIENTRY * dllGetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params);
static GLvoid 			(APIENTRY * dllGetTexParameteriv)(GLenum target, GLenum pname, GLint *params);
static GLvoid 			(APIENTRY * dllHint)(GLenum target, GLenum mode);
static GLvoid 			(APIENTRY * dllIndexMask)(GLuint mask);
static GLvoid 			(APIENTRY * dllIndexPointer)(GLenum type, GLsizei stride, const GLvoid *pointer);
static GLvoid 			(APIENTRY * dllIndexd)(GLdouble c);
static GLvoid 			(APIENTRY * dllIndexdv)(const GLdouble *c);
static GLvoid 			(APIENTRY * dllIndexf)(GLfloat c);
static GLvoid 			(APIENTRY * dllIndexfv)(const GLfloat *c);
static GLvoid 			(APIENTRY * dllIndexi)(GLint c);
static GLvoid 			(APIENTRY * dllIndexiv)(const GLint *c);
static GLvoid 			(APIENTRY * dllIndexs)(GLshort c);
static GLvoid 			(APIENTRY * dllIndexsv)(const GLshort *c);
static GLvoid 			(APIENTRY * dllIndexub)(GLubyte c);
static GLvoid 			(APIENTRY * dllIndexubv)(const GLubyte *c);
static GLvoid 			(APIENTRY * dllInitNames)(GLvoid);
static GLvoid 			(APIENTRY * dllInterleavedArrays)(GLenum format, GLsizei stride, const GLvoid *pointer);
static GLboolean		(APIENTRY * dllIsEnabled)(GLenum cap);
static GLboolean		(APIENTRY * dllIsList)(GLuint list);
static GLboolean		(APIENTRY * dllIsTexture)(GLuint texture);
static GLvoid 			(APIENTRY * dllLightModelf)(GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllLightModelfv)(GLenum pname, const GLfloat *params);
static GLvoid 			(APIENTRY * dllLightModeli)(GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllLightModeliv)(GLenum pname, const GLint *params);
static GLvoid 			(APIENTRY * dllLightf)(GLenum light, GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllLightfv)(GLenum light, GLenum pname, const GLfloat *params);
static GLvoid 			(APIENTRY * dllLighti)(GLenum light, GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllLightiv)(GLenum light, GLenum pname, const GLint *params);
static GLvoid 			(APIENTRY * dllLineStipple)(GLint factor, GLushort pattern);
static GLvoid 			(APIENTRY * dllLineWidth)(GLfloat width);
static GLvoid 			(APIENTRY * dllListBase)(GLuint base);
static GLvoid 			(APIENTRY * dllLoadIdentity)(GLvoid);
static GLvoid 			(APIENTRY * dllLoadMatrixd)(const GLdouble *m);
static GLvoid 			(APIENTRY * dllLoadMatrixf)(const GLfloat *m);
static GLvoid 			(APIENTRY * dllLoadName)(GLuint name);
static GLvoid 			(APIENTRY * dllLogicOp)(GLenum opcode);
static GLvoid 			(APIENTRY * dllMap1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
static GLvoid 			(APIENTRY * dllMap1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
static GLvoid 			(APIENTRY * dllMap2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
static GLvoid 			(APIENTRY * dllMap2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
static GLvoid 			(APIENTRY * dllMapGrid1d)(GLint un, GLdouble u1, GLdouble u2);
static GLvoid 			(APIENTRY * dllMapGrid1f)(GLint un, GLfloat u1, GLfloat u2);
static GLvoid 			(APIENTRY * dllMapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
static GLvoid 			(APIENTRY * dllMapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
static GLvoid 			(APIENTRY * dllMaterialf)(GLenum face, GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllMaterialfv)(GLenum face, GLenum pname, const GLfloat *params);
static GLvoid 			(APIENTRY * dllMateriali)(GLenum face, GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllMaterialiv)(GLenum face, GLenum pname, const GLint *params);
static GLvoid 			(APIENTRY * dllMatrixMode)(GLenum mode);
static GLvoid 			(APIENTRY * dllMultMatrixd)(const GLdouble *m);
static GLvoid 			(APIENTRY * dllMultMatrixf)(const GLfloat *m);
static GLvoid 			(APIENTRY * dllNewList)(GLuint list, GLenum mode);
static GLvoid 			(APIENTRY * dllNormal3b)(GLbyte nx, GLbyte ny, GLbyte nz);
static GLvoid 			(APIENTRY * dllNormal3bv)(const GLbyte *v);
static GLvoid 			(APIENTRY * dllNormal3d)(GLdouble nx, GLdouble ny, GLdouble nz);
static GLvoid 			(APIENTRY * dllNormal3dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz);
static GLvoid 			(APIENTRY * dllNormal3fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllNormal3i)(GLint nx, GLint ny, GLint nz);
static GLvoid 			(APIENTRY * dllNormal3iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllNormal3s)(GLshort nx, GLshort ny, GLshort nz);
static GLvoid 			(APIENTRY * dllNormal3sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer);
static GLvoid 			(APIENTRY * dllOrtho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
static GLvoid 			(APIENTRY * dllPassThrough)(GLfloat token);
static GLvoid 			(APIENTRY * dllPixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat *values);
static GLvoid 			(APIENTRY * dllPixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint *values);
static GLvoid 			(APIENTRY * dllPixelMapusv)(GLenum map, GLsizei mapsize, const GLushort *values);
static GLvoid 			(APIENTRY * dllPixelStoref)(GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllPixelStorei)(GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllPixelTransferf)(GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllPixelTransferi)(GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllPixelZoom)(GLfloat xfactor, GLfloat yfactor);
static GLvoid 			(APIENTRY * dllPointSize)(GLfloat size);
static GLvoid 			(APIENTRY * dllPolygonMode)(GLenum face, GLenum mode);
static GLvoid 			(APIENTRY * dllPolygonOffset)(GLfloat factor, GLfloat units);
static GLvoid 			(APIENTRY * dllPolygonStipple)(const GLubyte *mask);
static GLvoid 			(APIENTRY * dllPopAttrib)(GLvoid);
static GLvoid 			(APIENTRY * dllPopClientAttrib)(GLvoid);
static GLvoid 			(APIENTRY * dllPopMatrix)(GLvoid);
static GLvoid 			(APIENTRY * dllPopName)(GLvoid);
static GLvoid 			(APIENTRY * dllPrioritizeTextures)(GLsizei n, const GLuint *textures, const GLclampf *priorities);
static GLvoid 			(APIENTRY * dllPushAttrib)(GLbitfield mask);
static GLvoid 			(APIENTRY * dllPushClientAttrib)(GLbitfield mask);
static GLvoid 			(APIENTRY * dllPushMatrix)(GLvoid);
static GLvoid 			(APIENTRY * dllPushName)(GLuint name);
static GLvoid 			(APIENTRY * dllRasterPos2d)(GLdouble x, GLdouble y);
static GLvoid 			(APIENTRY * dllRasterPos2dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllRasterPos2f)(GLfloat x, GLfloat y);
static GLvoid 			(APIENTRY * dllRasterPos2fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllRasterPos2i)(GLint x, GLint y);
static GLvoid 			(APIENTRY * dllRasterPos2iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllRasterPos2s)(GLshort x, GLshort y);
static GLvoid 			(APIENTRY * dllRasterPos2sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllRasterPos3d)(GLdouble x, GLdouble y, GLdouble z);
static GLvoid 			(APIENTRY * dllRasterPos3dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllRasterPos3f)(GLfloat x, GLfloat y, GLfloat z);
static GLvoid 			(APIENTRY * dllRasterPos3fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllRasterPos3i)(GLint x, GLint y, GLint z);
static GLvoid 			(APIENTRY * dllRasterPos3iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllRasterPos3s)(GLshort x, GLshort y, GLshort z);
static GLvoid 			(APIENTRY * dllRasterPos3sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllRasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
static GLvoid 			(APIENTRY * dllRasterPos4dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllRasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
static GLvoid 			(APIENTRY * dllRasterPos4fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllRasterPos4i)(GLint x, GLint y, GLint z, GLint w);
static GLvoid 			(APIENTRY * dllRasterPos4iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllRasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w);
static GLvoid 			(APIENTRY * dllRasterPos4sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllReadBuffer)(GLenum mode);
static GLvoid 			(APIENTRY * dllReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
static GLvoid 			(APIENTRY * dllRectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
static GLvoid 			(APIENTRY * dllRectdv)(const GLdouble *v1, const GLdouble *v2);
static GLvoid 			(APIENTRY * dllRectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
static GLvoid 			(APIENTRY * dllRectfv)(const GLfloat *v1, const GLfloat *v2);
static GLvoid 			(APIENTRY * dllRecti)(GLint x1, GLint y1, GLint x2, GLint y2);
static GLvoid 			(APIENTRY * dllRectiv)(const GLint *v1, const GLint *v2);
static GLvoid 			(APIENTRY * dllRects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
static GLvoid 			(APIENTRY * dllRectsv)(const GLshort *v1, const GLshort *v2);
static GLint			(APIENTRY * dllRenderMode)(GLenum mode);
static GLvoid 			(APIENTRY * dllRotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
static GLvoid 			(APIENTRY * dllRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
static GLvoid 			(APIENTRY * dllScaled)(GLdouble x, GLdouble y, GLdouble z);
static GLvoid 			(APIENTRY * dllScalef)(GLfloat x, GLfloat y, GLfloat z);
static GLvoid 			(APIENTRY * dllScissor)(GLint x, GLint y, GLsizei width, GLsizei height);
static GLvoid 			(APIENTRY * dllSelectBuffer)(GLsizei size, GLuint *buffer);
static GLvoid 			(APIENTRY * dllShadeModel)(GLenum mode);
static GLvoid 			(APIENTRY * dllStencilFunc)(GLenum func, GLint ref, GLuint mask);
static GLvoid 			(APIENTRY * dllStencilMask)(GLuint mask);
static GLvoid 			(APIENTRY * dllStencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
static GLvoid 			(APIENTRY * dllTexCoord1d)(GLdouble s);
static GLvoid 			(APIENTRY * dllTexCoord1dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllTexCoord1f)(GLfloat s);
static GLvoid 			(APIENTRY * dllTexCoord1fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllTexCoord1i)(GLint s);
static GLvoid 			(APIENTRY * dllTexCoord1iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllTexCoord1s)(GLshort s);
static GLvoid 			(APIENTRY * dllTexCoord1sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllTexCoord2d)(GLdouble s, GLdouble t);
static GLvoid 			(APIENTRY * dllTexCoord2dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllTexCoord2f)(GLfloat s, GLfloat t);
static GLvoid 			(APIENTRY * dllTexCoord2fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllTexCoord2i)(GLint s, GLint t);
static GLvoid 			(APIENTRY * dllTexCoord2iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllTexCoord2s)(GLshort s, GLshort t);
static GLvoid 			(APIENTRY * dllTexCoord2sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllTexCoord3d)(GLdouble s, GLdouble t, GLdouble r);
static GLvoid 			(APIENTRY * dllTexCoord3dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllTexCoord3f)(GLfloat s, GLfloat t, GLfloat r);
static GLvoid 			(APIENTRY * dllTexCoord3fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllTexCoord3i)(GLint s, GLint t, GLint r);
static GLvoid 			(APIENTRY * dllTexCoord3iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllTexCoord3s)(GLshort s, GLshort t, GLshort r);
static GLvoid 			(APIENTRY * dllTexCoord3sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllTexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
static GLvoid 			(APIENTRY * dllTexCoord4dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllTexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
static GLvoid 			(APIENTRY * dllTexCoord4fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllTexCoord4i)(GLint s, GLint t, GLint r, GLint q);
static GLvoid 			(APIENTRY * dllTexCoord4iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllTexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q);
static GLvoid 			(APIENTRY * dllTexCoord4sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
static GLvoid 			(APIENTRY * dllTexEnvf)(GLenum target, GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params);
static GLvoid 			(APIENTRY * dllTexEnvi)(GLenum target, GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllTexEnviv)(GLenum target, GLenum pname, const GLint *params);
static GLvoid 			(APIENTRY * dllTexGend)(GLenum coord, GLenum pname, GLdouble param);
static GLvoid 			(APIENTRY * dllTexGendv)(GLenum coord, GLenum pname, const GLdouble *params);
static GLvoid 			(APIENTRY * dllTexGenf)(GLenum coord, GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllTexGenfv)(GLenum coord, GLenum pname, const GLfloat *params);
static GLvoid 			(APIENTRY * dllTexGeni)(GLenum coord, GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllTexGeniv)(GLenum coord, GLenum pname, const GLint *params);
static GLvoid 			(APIENTRY * dllTexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
static GLvoid 			(APIENTRY * dllTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
static GLvoid 			(APIENTRY * dllTexParameterf)(GLenum target, GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params);
static GLvoid 			(APIENTRY * dllTexParameteri)(GLenum target, GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllTexParameteriv)(GLenum target, GLenum pname, const GLint *params);
static GLvoid 			(APIENTRY * dllTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
static GLvoid 			(APIENTRY * dllTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
static GLvoid 			(APIENTRY * dllTranslated)(GLdouble x, GLdouble y, GLdouble z);
static GLvoid 			(APIENTRY * dllTranslatef)(GLfloat x, GLfloat y, GLfloat z);
static GLvoid 			(APIENTRY * dllVertex2d)(GLdouble x, GLdouble y);
static GLvoid 			(APIENTRY * dllVertex2dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllVertex2f)(GLfloat x, GLfloat y);
static GLvoid 			(APIENTRY * dllVertex2fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllVertex2i)(GLint x, GLint y);
static GLvoid 			(APIENTRY * dllVertex2iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllVertex2s)(GLshort x, GLshort y);
static GLvoid 			(APIENTRY * dllVertex2sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllVertex3d)(GLdouble x, GLdouble y, GLdouble z);
static GLvoid 			(APIENTRY * dllVertex3dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllVertex3f)(GLfloat x, GLfloat y, GLfloat z);
static GLvoid 			(APIENTRY * dllVertex3fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllVertex3i)(GLint x, GLint y, GLint z);
static GLvoid 			(APIENTRY * dllVertex3iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllVertex3s)(GLshort x, GLshort y, GLshort z);
static GLvoid 			(APIENTRY * dllVertex3sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllVertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
static GLvoid 			(APIENTRY * dllVertex4dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllVertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
static GLvoid 			(APIENTRY * dllVertex4fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllVertex4i)(GLint x, GLint y, GLint z, GLint w);
static GLvoid 			(APIENTRY * dllVertex4iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllVertex4s)(GLshort x, GLshort y, GLshort z, GLshort w);
static GLvoid 			(APIENTRY * dllVertex4sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
static GLvoid 			(APIENTRY * dllViewport)(GLint x, GLint y, GLsizei width, GLsizei height);

static GLvoid			(APIENTRY * dllActiveTextureARB)(GLenum texture);
static GLvoid			(APIENTRY * dllClientActiveTextureARB)(GLenum texture);

static GLvoid			(APIENTRY * dllBindBufferARB)(GLenum target, GLuint buffer);
static GLvoid			(APIENTRY * dllDeleteBuffersARB)(GLsizei n, const GLuint *buffers);
static GLvoid			(APIENTRY * dllGenBuffersARB)(GLsizei n, GLuint *buffers);
static GLvoid			(APIENTRY * dllBufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
static GLvoid			(APIENTRY * dllBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);
static GLvoid *			(APIENTRY * dllMapBufferARB)(GLenum target, GLenum access);
static GLboolean		(APIENTRY * dllUnmapBufferARB)(GLenum target);

static GLvoid			(APIENTRY * dllActiveStencilFaceEXT)(GLenum face);

static GLvoid			(APIENTRY * dllStencilOpSeparateATI)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
static GLvoid			(APIENTRY * dllStencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);

static GLvoid			(APIENTRY * dllDepthBoundsEXT)(GLclampd zmin, GLclampd zmax);


#include "../ref_gl/qgl2.h"

#undef QGL_WGL_EXT
#undef QGL_WGL
#undef QGL_EXT
#undef QGL_FUNC

/*
** QGL_Shutdown
**
** Unloads the specified DLL then nulls out all the proc pointers.
*/
void QGL_Shutdown2( void )
{
	if ( glwState.hInstOpenGL )
		FreeLibrary( glwState.hInstOpenGL );

	glwState.hInstOpenGL = NULL;

#define QGL_FUNC(type,name,params) (q##name) = NULL;
#define QGL_EXT(type,name,params) (q##name) = NULL;
#define QGL_WGL(type,name,params) (q##name) = NULL;
#define QGL_WGL_EXT(type,name,params) (q##name) = NULL;

	qglAccum                    = NULL;
	qglAlphaFunc                = NULL;
	qglAreTexturesResident      = NULL;
	qglArrayElement             = NULL;
	qglBegin                    = NULL;
	qglBindTexture              = NULL;
	qglBitmap                   = NULL;
	qglBlendFunc                = NULL;
	qglCallList                 = NULL;
	qglCallLists                = NULL;
	qglClear                    = NULL;
	qglClearAccum               = NULL;
	qglClearColor               = NULL;
	qglClearDepth               = NULL;
	qglClearIndex               = NULL;
	qglClearStencil             = NULL;
	qglClipPlane                = NULL;
	qglColor3b                  = NULL;
	qglColor3bv                 = NULL;
	qglColor3d                  = NULL;
	qglColor3dv                 = NULL;
	qglColor3f                  = NULL;
	qglColor3fv                 = NULL;
	qglColor3i                  = NULL;
	qglColor3iv                 = NULL;
	qglColor3s                  = NULL;
	qglColor3sv                 = NULL;
	qglColor3ub                 = NULL;
	qglColor3ubv                = NULL;
	qglColor3ui                 = NULL;
	qglColor3uiv                = NULL;
	qglColor3us                 = NULL;
	qglColor3usv                = NULL;
	qglColor4b                  = NULL;
	qglColor4bv                 = NULL;
	qglColor4d                  = NULL;
	qglColor4dv                 = NULL;
	qglColor4f                  = NULL;
	qglColor4fv                 = NULL;
	qglColor4i                  = NULL;
	qglColor4iv                 = NULL;
	qglColor4s                  = NULL;
	qglColor4sv                 = NULL;
	qglColor4ub                 = NULL;
	qglColor4ubv                = NULL;
	qglColor4ui                 = NULL;
	qglColor4uiv                = NULL;
	qglColor4us                 = NULL;
	qglColor4usv                = NULL;
	qglColorMask                = NULL;
	qglColorMaterial            = NULL;
	qglColorPointer             = NULL;
	qglCopyPixels               = NULL;
	qglCopyTexImage1D           = NULL;
	qglCopyTexImage2D           = NULL;
	qglCopyTexSubImage1D        = NULL;
	qglCopyTexSubImage2D        = NULL;
	qglCullFace                 = NULL;
	qglDeleteLists              = NULL;
	qglDeleteTextures           = NULL;
	qglDepthFunc                = NULL;
	qglDepthMask                = NULL;
	qglDepthRange               = NULL;
	qglDisable                  = NULL;
	qglDisableClientState       = NULL;
	qglDrawArrays               = NULL;
	qglDrawBuffer               = NULL;
	qglDrawElements             = NULL;
	qglDrawPixels               = NULL;
	qglEdgeFlag                 = NULL;
	qglEdgeFlagPointer          = NULL;
	qglEdgeFlagv                = NULL;
	qglEnable                   = NULL;
	qglEnableClientState        = NULL;
	qglEnd                      = NULL;
	qglEndList                  = NULL;
	qglEvalCoord1d              = NULL;
	qglEvalCoord1dv             = NULL;
	qglEvalCoord1f              = NULL;
	qglEvalCoord1fv             = NULL;
	qglEvalCoord2d              = NULL;
	qglEvalCoord2dv             = NULL;
	qglEvalCoord2f              = NULL;
	qglEvalCoord2fv             = NULL;
	qglEvalMesh1                = NULL;
	qglEvalMesh2                = NULL;
	qglEvalPoint1               = NULL;
	qglEvalPoint2               = NULL;
	qglFeedbackBuffer           = NULL;
	qglFinish                   = NULL;
	qglFlush                    = NULL;
	qglFogf                     = NULL;
	qglFogfv                    = NULL;
	qglFogi                     = NULL;
	qglFogiv                    = NULL;
	qglFrontFace                = NULL;
	qglFrustum                  = NULL;
	qglGenLists                 = NULL;
	qglGenTextures              = NULL;
	qglGetBooleanv              = NULL;
	qglGetClipPlane             = NULL;
	qglGetDoublev               = NULL;
	qglGetError                 = NULL;
	qglGetFloatv                = NULL;
	qglGetIntegerv              = NULL;
	qglGetLightfv               = NULL;
	qglGetLightiv               = NULL;
	qglGetMapdv                 = NULL;
	qglGetMapfv                 = NULL;
	qglGetMapiv                 = NULL;
	qglGetMaterialfv            = NULL;
	qglGetMaterialiv            = NULL;
	qglGetPixelMapfv            = NULL;
	qglGetPixelMapuiv           = NULL;
	qglGetPixelMapusv           = NULL;
	qglGetPointerv              = NULL;
	qglGetPolygonStipple        = NULL;
	qglGetString                = NULL;
	qglGetTexEnvfv              = NULL;
	qglGetTexEnviv              = NULL;
	qglGetTexGendv              = NULL;
	qglGetTexGenfv              = NULL;
	qglGetTexGeniv              = NULL;
	qglGetTexImage              = NULL;
	qglGetTexLevelParameterfv   = NULL;
	qglGetTexLevelParameteriv   = NULL;
	qglGetTexParameterfv        = NULL;
	qglGetTexParameteriv        = NULL;
	qglHint                     = NULL;
	qglIndexMask                = NULL;
	qglIndexPointer             = NULL;
	qglIndexd                   = NULL;
	qglIndexdv                  = NULL;
	qglIndexf                   = NULL;
	qglIndexfv                  = NULL;
	qglIndexi                   = NULL;
	qglIndexiv                  = NULL;
	qglIndexs                   = NULL;
	qglIndexsv                  = NULL;
	qglIndexub                  = NULL;
	qglIndexubv                 = NULL;
	qglInitNames                = NULL;
	qglInterleavedArrays        = NULL;
	qglIsEnabled                = NULL;
	qglIsList                   = NULL;
	qglIsTexture                = NULL;
	qglLightModelf              = NULL;
	qglLightModelfv             = NULL;
	qglLightModeli              = NULL;
	qglLightModeliv             = NULL;
	qglLightf                   = NULL;
	qglLightfv                  = NULL;
	qglLighti                   = NULL;
	qglLightiv                  = NULL;
	qglLineStipple              = NULL;
	qglLineWidth                = NULL;
	qglListBase                 = NULL;
	qglLoadIdentity             = NULL;
	qglLoadMatrixd              = NULL;
	qglLoadMatrixf              = NULL;
	qglLoadName                 = NULL;
	qglLogicOp                  = NULL;
	qglMap1d                    = NULL;
	qglMap1f                    = NULL;
	qglMap2d                    = NULL;
	qglMap2f                    = NULL;
	qglMapGrid1d                = NULL;
	qglMapGrid1f                = NULL;
	qglMapGrid2d                = NULL;
	qglMapGrid2f                = NULL;
	qglMaterialf                = NULL;
	qglMaterialfv               = NULL;
	qglMateriali                = NULL;
	qglMaterialiv               = NULL;
	qglMatrixMode               = NULL;
	qglMultMatrixd              = NULL;
	qglMultMatrixf              = NULL;
	qglNewList                  = NULL;
	qglNormal3b                 = NULL;
	qglNormal3bv                = NULL;
	qglNormal3d                 = NULL;
	qglNormal3dv                = NULL;
	qglNormal3f                 = NULL;
	qglNormal3fv                = NULL;
	qglNormal3i                 = NULL;
	qglNormal3iv                = NULL;
	qglNormal3s                 = NULL;
	qglNormal3sv                = NULL;
	qglNormalPointer            = NULL;
	qglOrtho                    = NULL;
	qglPassThrough              = NULL;
	qglPixelMapfv               = NULL;
	qglPixelMapuiv              = NULL;
	qglPixelMapusv              = NULL;
	qglPixelStoref              = NULL;
	qglPixelStorei              = NULL;
	qglPixelTransferf           = NULL;
	qglPixelTransferi           = NULL;
	qglPixelZoom                = NULL;
	qglPointSize                = NULL;
	qglPolygonMode              = NULL;
	qglPolygonOffset            = NULL;
	qglPolygonStipple           = NULL;
	qglPopAttrib                = NULL;
	qglPopClientAttrib          = NULL;
	qglPopMatrix                = NULL;
	qglPopName                  = NULL;
	qglPrioritizeTextures       = NULL;
	qglPushAttrib               = NULL;
	qglPushClientAttrib         = NULL;
	qglPushMatrix               = NULL;
	qglPushName                 = NULL;
	qglRasterPos2d              = NULL;
	qglRasterPos2dv             = NULL;
	qglRasterPos2f              = NULL;
	qglRasterPos2fv             = NULL;
	qglRasterPos2i              = NULL;
	qglRasterPos2iv             = NULL;
	qglRasterPos2s              = NULL;
	qglRasterPos2sv             = NULL;
	qglRasterPos3d              = NULL;
	qglRasterPos3dv             = NULL;
	qglRasterPos3f              = NULL;
	qglRasterPos3fv             = NULL;
	qglRasterPos3i              = NULL;
	qglRasterPos3iv             = NULL;
	qglRasterPos3s              = NULL;
	qglRasterPos3sv             = NULL;
	qglRasterPos4d              = NULL;
	qglRasterPos4dv             = NULL;
	qglRasterPos4f              = NULL;
	qglRasterPos4fv             = NULL;
	qglRasterPos4i              = NULL;
	qglRasterPos4iv             = NULL;
	qglRasterPos4s              = NULL;
	qglRasterPos4sv             = NULL;
	qglReadBuffer               = NULL;
	qglReadPixels               = NULL;
	qglRectd                    = NULL;
	qglRectdv                   = NULL;
	qglRectf                    = NULL;
	qglRectfv                   = NULL;
	qglRecti                    = NULL;
	qglRectiv                   = NULL;
	qglRects                    = NULL;
	qglRectsv                   = NULL;
	qglRenderMode               = NULL;
	qglRotated                  = NULL;
	qglRotatef                  = NULL;
	qglScaled                   = NULL;
	qglScalef                   = NULL;
	qglScissor                  = NULL;
	qglSelectBuffer             = NULL;
	qglShadeModel               = NULL;
	qglStencilFunc              = NULL;
	qglStencilMask              = NULL;
	qglStencilOp                = NULL;
	qglTexCoord1d               = NULL;
	qglTexCoord1dv              = NULL;
	qglTexCoord1f               = NULL;
	qglTexCoord1fv              = NULL;
	qglTexCoord1i               = NULL;
	qglTexCoord1iv              = NULL;
	qglTexCoord1s               = NULL;
	qglTexCoord1sv              = NULL;
	qglTexCoord2d               = NULL;
	qglTexCoord2dv              = NULL;
	qglTexCoord2f               = NULL;
	qglTexCoord2fv              = NULL;
	qglTexCoord2i               = NULL;
	qglTexCoord2iv              = NULL;
	qglTexCoord2s               = NULL;
	qglTexCoord2sv              = NULL;
	qglTexCoord3d               = NULL;
	qglTexCoord3dv              = NULL;
	qglTexCoord3f               = NULL;
	qglTexCoord3fv              = NULL;
	qglTexCoord3i               = NULL;
	qglTexCoord3iv              = NULL;
	qglTexCoord3s               = NULL;
	qglTexCoord3sv              = NULL;
	qglTexCoord4d               = NULL;
	qglTexCoord4dv              = NULL;
	qglTexCoord4f               = NULL;
	qglTexCoord4fv              = NULL;
	qglTexCoord4i               = NULL;
	qglTexCoord4iv              = NULL;
	qglTexCoord4s               = NULL;
	qglTexCoord4sv              = NULL;
	qglTexCoordPointer          = NULL;
	qglTexEnvf                  = NULL;
	qglTexEnvfv                 = NULL;
	qglTexEnvi                  = NULL;
	qglTexEnviv                 = NULL;
	qglTexGend                  = NULL;
	qglTexGendv                 = NULL;
	qglTexGenf                  = NULL;
	qglTexGenfv                 = NULL;
	qglTexGeni                  = NULL;
	qglTexGeniv                 = NULL;
	qglTexImage1D               = NULL;
	qglTexImage2D               = NULL;
	qglTexParameterf            = NULL;
	qglTexParameterfv           = NULL;
	qglTexParameteri            = NULL;
	qglTexParameteriv           = NULL;
	qglTexSubImage1D            = NULL;
	qglTexSubImage2D            = NULL;
	qglTranslated               = NULL;
	qglTranslatef               = NULL;
	qglVertex2d                 = NULL;
	qglVertex2dv                = NULL;
	qglVertex2f                 = NULL;
	qglVertex2fv                = NULL;
	qglVertex2i                 = NULL;
	qglVertex2iv                = NULL;
	qglVertex2s                 = NULL;
	qglVertex2sv                = NULL;
	qglVertex3d                 = NULL;
	qglVertex3dv                = NULL;
	qglVertex3f                 = NULL;
	qglVertex3fv                = NULL;
	qglVertex3i                 = NULL;
	qglVertex3iv                = NULL;
	qglVertex3s                 = NULL;
	qglVertex3sv                = NULL;
	qglVertex4d                 = NULL;
	qglVertex4dv                = NULL;
	qglVertex4f                 = NULL;
	qglVertex4fv                = NULL;
	qglVertex4i                 = NULL;
	qglVertex4iv                = NULL;
	qglVertex4s                 = NULL;
	qglVertex4sv                = NULL;
	qglVertexPointer            = NULL;
	qglViewport                 = NULL;

	qglActiveTextureARB					= NULL;
	qglClientActiveTextureARB			= NULL;

	qglBindBufferARB					= NULL;
	qglDeleteBuffersARB					= NULL;
	qglGenBuffersARB					= NULL;
	qglBufferDataARB					= NULL;
	qglBufferSubDataARB					= NULL;
	qglMapBufferARB						= NULL;
	qglUnmapBufferARB					= NULL;

	qglBindAttribLocationARB			= NULL;
	qglGetActiveAttribARB				= NULL;
	qglGetAttribLocationARB				= NULL;

	qglVertexAttribPointerARB			= NULL;
	qglEnableVertexAttribArrayARB		= NULL;
	qglDisableVertexAttribArrayARB		= NULL;

	qglDeleteObjectARB					= NULL;
	qglGetHandleARB						= NULL;
	qglDetachObjectARB					= NULL;
	qglCreateShaderObjectARB			= NULL;
	qglShaderSourceARB					= NULL;
	qglCompileShaderARB					= NULL;
	qglCreateProgramObjectARB			= NULL;
	qglAttachObjectARB					= NULL;
	qglLinkProgramARB					= NULL;
	qglUseProgramObjectARB				= NULL;
	qglValidateProgramARB				= NULL;
	qglUniform1fARB						= NULL;
	qglUniform2fARB						= NULL;
	qglUniform3fARB						= NULL;
	qglUniform4fARB						= NULL;
	qglUniform1iARB						= NULL;
	qglUniform2iARB						= NULL;
	qglUniform3iARB						= NULL;
	qglUniform4iARB						= NULL;
	qglUniform1fvARB					= NULL;
	qglUniform2fvARB					= NULL;
	qglUniform3fvARB					= NULL;
	qglUniform4fvARB					= NULL;
	qglUniform1ivARB					= NULL;
	qglUniform2ivARB					= NULL;
	qglUniform3ivARB					= NULL;
	qglUniform4ivARB					= NULL;
	qglUniformMatrix2fvARB				= NULL;
	qglUniformMatrix3fvARB				= NULL;
	qglUniformMatrix4fvARB				= NULL;
	qglGetObjectParameterfvARB			= NULL;
	qglGetObjectParameterivARB			= NULL;
	qglGetInfoLogARB					= NULL;
	qglGetAttachedObjectsARB			= NULL;
	qglGetUniformLocationARB			= NULL;
	qglGetActiveUniformARB				= NULL;
	qglGetUniformfvARB					= NULL;
	qglGetUniformivARB					= NULL;
	qglGetShaderSourceARB				= NULL;

	qglActiveStencilFaceEXT				= NULL;

	qglStencilOpSeparateATI				= NULL;
	qglStencilFuncSeparateATI			= NULL;

	qglDepthBoundsEXT					= NULL;

#include "../ref_gl/qgl2.h"

#undef QGL_WGL_EXT
#undef QGL_WGL
#undef QGL_EXT
#undef QGL_FUNC
}

static void *QGL_GetProcAddress (const char *funcName){

	void	*funcAddress;

	funcAddress = GetProcAddress(glwState.hInstOpenGL, funcName);
	if (!funcAddress){
		FreeLibrary(glwState.hInstOpenGL);
		glwState.hInstOpenGL = NULL;

		Com_Error(ERR_FATAL, "QGL_GetProcAddress: GetProcAddress() failed for '%s'", funcName);
	}

	return funcAddress;
}

//#	define GPA( a ) GetProcAddress( glwState.hInstOpenGL, a )

/*
** QGL_Init
**
** This is responsible for binding our qgl function pointers to 
** the appropriate GL stuff.  In Windows this means doing a 
** LoadLibrary and a bunch of calls to GetProcAddress.  On other
** operating systems we need to do the right thing, whatever that
** might be.
** 
*/
qboolean QGL_Init2( const char *dllname )
{
	if ( ( glwState.hInstOpenGL = LoadLibrary( dllname ) ) == 0 )
	{
		char *buf = NULL;

		FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &buf, 0, NULL);
		Com_Printf ( "%s\n", buf );
		LocalFree((void *)buf);
		return false;
	}

#define QGL_FUNC(type,name,params) (q##name) = (decltype(q##name))GetProcAddress( glwState.hInstOpenGL, #name ); \
	if( !(q##name) ) { Com_Printf( "QGL_Init: Failed to get address for %s\n", #name ); return false; }
#define QGL_EXT(type,name,params) (q##name) = NULL;
#define QGL_WGL(type,name,params) (q##name) = (decltype(q##name))GetProcAddress( glwState.hInstOpenGL, #name ); \
	if( !(q##name) ) { Com_Printf( "QGL_Init: Failed to get address for %s\n", #name ); return false; }
#define QGL_WGL_EXT(type,name,params) (q##name) = NULL;

	qglAccum					= dllAccum						= (decltype(dllAccum					))QGL_GetProcAddress("glAccum");
	qglAlphaFunc                = dllAlphaFunc					= (decltype(dllAlphaFunc				))QGL_GetProcAddress("glAlphaFunc");
	qglAreTexturesResident      = dllAreTexturesResident		= (decltype(dllAreTexturesResident	))QGL_GetProcAddress("glAreTexturesResident");
	qglArrayElement             = dllArrayElement				= (decltype(dllArrayElement			))QGL_GetProcAddress("glArrayElement");
	qglBegin                    = dllBegin						= (decltype(dllBegin					))QGL_GetProcAddress("glBegin");
	qglBindTexture              = dllBindTexture				= (decltype(dllBindTexture			))QGL_GetProcAddress("glBindTexture");
	qglBitmap                   = dllBitmap						= (decltype(dllBitmap					))QGL_GetProcAddress("glBitmap");
	qglBlendFunc                = dllBlendFunc					= (decltype(dllBlendFunc				))QGL_GetProcAddress("glBlendFunc");
	qglCallList                 = dllCallList					= (decltype(dllCallList				))QGL_GetProcAddress("glCallList");
	qglCallLists                = dllCallLists					= (decltype(dllCallLists				))QGL_GetProcAddress("glCallLists");
	qglClear                    = dllClear						= (decltype(dllClear					))QGL_GetProcAddress("glClear");
	qglClearAccum               = dllClearAccum					= (decltype(dllClearAccum				))QGL_GetProcAddress("glClearAccum");
	qglClearColor               = dllClearColor					= (decltype(dllClearColor				))QGL_GetProcAddress("glClearColor");
	qglClearDepth               = dllClearDepth					= (decltype(dllClearDepth				))QGL_GetProcAddress("glClearDepth");
	qglClearIndex               = dllClearIndex					= (decltype(dllClearIndex				))QGL_GetProcAddress("glClearIndex");
	qglClearStencil             = dllClearStencil				= (decltype(dllClearStencil			))QGL_GetProcAddress("glClearStencil");
	qglClipPlane                = dllClipPlane					= (decltype(dllClipPlane				))QGL_GetProcAddress("glClipPlane");
	qglColor3b                  = dllColor3b					= (decltype(dllColor3b				))QGL_GetProcAddress("glColor3b");
	qglColor3bv                 = dllColor3bv					= (decltype(dllColor3bv				))QGL_GetProcAddress("glColor3bv");
	qglColor3d                  = dllColor3d					= (decltype(dllColor3d				))QGL_GetProcAddress("glColor3d");
	qglColor3dv                 = dllColor3dv					= (decltype(dllColor3dv				))QGL_GetProcAddress("glColor3dv");
	qglColor3f                  = dllColor3f					= (decltype(dllColor3f				))QGL_GetProcAddress("glColor3f");
	qglColor3fv                 = dllColor3fv					= (decltype(dllColor3fv				))QGL_GetProcAddress("glColor3fv");
	qglColor3i                  = dllColor3i					= (decltype(dllColor3i				))QGL_GetProcAddress("glColor3i");
	qglColor3iv                 = dllColor3iv					= (decltype(dllColor3iv				))QGL_GetProcAddress("glColor3iv");
	qglColor3s                  = dllColor3s					= (decltype(dllColor3s				))QGL_GetProcAddress("glColor3s");
	qglColor3sv                 = dllColor3sv					= (decltype(dllColor3sv				))QGL_GetProcAddress("glColor3sv");
	qglColor3ub                 = dllColor3ub					= (decltype(dllColor3ub				))QGL_GetProcAddress("glColor3ub");
	qglColor3ubv                = dllColor3ubv					= (decltype(dllColor3ubv				))QGL_GetProcAddress("glColor3ubv");
	qglColor3ui                 = dllColor3ui					= (decltype(dllColor3ui				))QGL_GetProcAddress("glColor3ui");
	qglColor3uiv                = dllColor3uiv					= (decltype(dllColor3uiv				))QGL_GetProcAddress("glColor3uiv");
	qglColor3us                 = dllColor3us					= (decltype(dllColor3us				))QGL_GetProcAddress("glColor3us");
	qglColor3usv                = dllColor3usv					= (decltype(dllColor3usv				))QGL_GetProcAddress("glColor3usv");
	qglColor4b                  = dllColor4b					= (decltype(dllColor4b				))QGL_GetProcAddress("glColor4b");
	qglColor4bv                 = dllColor4bv					= (decltype(dllColor4bv				))QGL_GetProcAddress("glColor4bv");
	qglColor4d                  = dllColor4d					= (decltype(dllColor4d				))QGL_GetProcAddress("glColor4d");
	qglColor4dv                 = dllColor4dv					= (decltype(dllColor4dv				))QGL_GetProcAddress("glColor4dv");
	qglColor4f                  = dllColor4f					= (decltype(dllColor4f				))QGL_GetProcAddress("glColor4f");
	qglColor4fv                 = dllColor4fv					= (decltype(dllColor4fv				))QGL_GetProcAddress("glColor4fv");
	qglColor4i                  = dllColor4i					= (decltype(dllColor4i				))QGL_GetProcAddress("glColor4i");
	qglColor4iv                 = dllColor4iv					= (decltype(dllColor4iv				))QGL_GetProcAddress("glColor4iv");
	qglColor4s                  = dllColor4s					= (decltype(dllColor4s				))QGL_GetProcAddress("glColor4s");
	qglColor4sv                 = dllColor4sv					= (decltype(dllColor4sv				))QGL_GetProcAddress("glColor4sv");
	qglColor4ub                 = dllColor4ub					= (decltype(dllColor4ub				))QGL_GetProcAddress("glColor4ub");
	qglColor4ubv                = dllColor4ubv					= (decltype(dllColor4ubv				))QGL_GetProcAddress("glColor4ubv");
	qglColor4ui                 = dllColor4ui					= (decltype(dllColor4ui				))QGL_GetProcAddress("glColor4ui");
	qglColor4uiv                = dllColor4uiv					= (decltype(dllColor4uiv				))QGL_GetProcAddress("glColor4uiv");
	qglColor4us                 = dllColor4us					= (decltype(dllColor4us				))QGL_GetProcAddress("glColor4us");
	qglColor4usv                = dllColor4usv					= (decltype(dllColor4usv				))QGL_GetProcAddress("glColor4usv");
	qglColorMask                = dllColorMask					= (decltype(dllColorMask				))QGL_GetProcAddress("glColorMask");
	qglColorMaterial            = dllColorMaterial				= (decltype(dllColorMaterial			))QGL_GetProcAddress("glColorMaterial");
	qglColorPointer             = dllColorPointer				= (decltype(dllColorPointer			))QGL_GetProcAddress("glColorPointer");
	qglCopyPixels               = dllCopyPixels					= (decltype(dllCopyPixels				))QGL_GetProcAddress("glCopyPixels");
	qglCopyTexImage1D           = dllCopyTexImage1D				= (decltype(dllCopyTexImage1D			))QGL_GetProcAddress("glCopyTexImage1D");
	qglCopyTexImage2D           = dllCopyTexImage2D				= (decltype(dllCopyTexImage2D			))QGL_GetProcAddress("glCopyTexImage2D");
	qglCopyTexSubImage1D        = dllCopyTexSubImage1D			= (decltype(dllCopyTexSubImage1D		))QGL_GetProcAddress("glCopyTexSubImage1D");
	qglCopyTexSubImage2D        = dllCopyTexSubImage2D			= (decltype(dllCopyTexSubImage2D		))QGL_GetProcAddress("glCopyTexSubImage2D");
	qglCullFace                 = dllCullFace					= (decltype(dllCullFace				))QGL_GetProcAddress("glCullFace");
	qglDeleteLists              = dllDeleteLists				= (decltype(dllDeleteLists			))QGL_GetProcAddress("glDeleteLists");
	qglDeleteTextures           = dllDeleteTextures				= (decltype(dllDeleteTextures			))QGL_GetProcAddress("glDeleteTextures");
	qglDepthFunc                = dllDepthFunc					= (decltype(dllDepthFunc				))QGL_GetProcAddress("glDepthFunc");
	qglDepthMask                = dllDepthMask					= (decltype(dllDepthMask				))QGL_GetProcAddress("glDepthMask");
	qglDepthRange               = dllDepthRange					= (decltype(dllDepthRange				))QGL_GetProcAddress("glDepthRange");
	qglDisable                  = dllDisable					= (decltype(dllDisable				))QGL_GetProcAddress("glDisable");
	qglDisableClientState       = dllDisableClientState			= (decltype(dllDisableClientState		))QGL_GetProcAddress("glDisableClientState");
	qglDrawArrays               = dllDrawArrays					= (decltype(dllDrawArrays				))QGL_GetProcAddress("glDrawArrays");
	qglDrawBuffer               = dllDrawBuffer					= (decltype(dllDrawBuffer				))QGL_GetProcAddress("glDrawBuffer");
	qglDrawElements				= dllDrawElements				= (decltype(dllDrawElements			))QGL_GetProcAddress("glDrawElements");
	qglDrawPixels				= dllDrawPixels					= (decltype(dllDrawPixels				))QGL_GetProcAddress("glDrawPixels");
	qglEdgeFlag                 = dllEdgeFlag					= (decltype(dllEdgeFlag				))QGL_GetProcAddress("glEdgeFlag");
	qglEdgeFlagPointer          = dllEdgeFlagPointer			= (decltype(dllEdgeFlagPointer		))QGL_GetProcAddress("glEdgeFlagPointer");
	qglEdgeFlagv                = dllEdgeFlagv					= (decltype(dllEdgeFlagv				))QGL_GetProcAddress("glEdgeFlagv");
	qglEnable                   = dllEnable						= (decltype(dllEnable					))QGL_GetProcAddress("glEnable");
	qglEnableClientState        = dllEnableClientState			= (decltype(dllEnableClientState		))QGL_GetProcAddress("glEnableClientState");
	qglEnd                      = dllEnd						= (decltype(dllEnd					))QGL_GetProcAddress("glEnd");
	qglEndList                  = dllEndList					= (decltype(dllEndList				))QGL_GetProcAddress("glEndList");
	qglEvalCoord1d				= dllEvalCoord1d				= (decltype(dllEvalCoord1d			))QGL_GetProcAddress("glEvalCoord1d");
	qglEvalCoord1dv             = dllEvalCoord1dv				= (decltype(dllEvalCoord1dv			))QGL_GetProcAddress("glEvalCoord1dv");
	qglEvalCoord1f              = dllEvalCoord1f				= (decltype(dllEvalCoord1f			))QGL_GetProcAddress("glEvalCoord1f");
	qglEvalCoord1fv             = dllEvalCoord1fv				= (decltype(dllEvalCoord1fv			))QGL_GetProcAddress("glEvalCoord1fv");
	qglEvalCoord2d              = dllEvalCoord2d				= (decltype(dllEvalCoord2d			))QGL_GetProcAddress("glEvalCoord2d");
	qglEvalCoord2dv             = dllEvalCoord2dv				= (decltype(dllEvalCoord2dv			))QGL_GetProcAddress("glEvalCoord2dv");
	qglEvalCoord2f              = dllEvalCoord2f				= (decltype(dllEvalCoord2f			))QGL_GetProcAddress("glEvalCoord2f");
	qglEvalCoord2fv             = dllEvalCoord2fv				= (decltype(dllEvalCoord2fv			))QGL_GetProcAddress("glEvalCoord2fv");
	qglEvalMesh1                = dllEvalMesh1					= (decltype(dllEvalMesh1				))QGL_GetProcAddress("glEvalMesh1");
	qglEvalMesh2                = dllEvalMesh2					= (decltype(dllEvalMesh2				))QGL_GetProcAddress("glEvalMesh2");
	qglEvalPoint1               = dllEvalPoint1					= (decltype(dllEvalPoint1				))QGL_GetProcAddress("glEvalPoint1");
	qglEvalPoint2               = dllEvalPoint2					= (decltype(dllEvalPoint2				))QGL_GetProcAddress("glEvalPoint2");
	qglFeedbackBuffer           = dllFeedbackBuffer				= (decltype(dllFeedbackBuffer			))QGL_GetProcAddress("glFeedbackBuffer");
	qglFinish                   = dllFinish						= (decltype(dllFinish					))QGL_GetProcAddress("glFinish");
	qglFlush                    = dllFlush						= (decltype(dllFlush					))QGL_GetProcAddress("glFlush");
	qglFogf                     = dllFogf						= (decltype(dllFogf					))QGL_GetProcAddress("glFogf");
	qglFogfv                    = dllFogfv						= (decltype(dllFogfv					))QGL_GetProcAddress("glFogfv");
	qglFogi                     = dllFogi						= (decltype(dllFogi					))QGL_GetProcAddress("glFogi");
	qglFogiv                    = dllFogiv						= (decltype(dllFogiv					))QGL_GetProcAddress("glFogiv");
	qglFrontFace                = dllFrontFace					= (decltype(dllFrontFace				))QGL_GetProcAddress("glFrontFace");
	qglFrustum                  = dllFrustum					= (decltype(dllFrustum				))QGL_GetProcAddress("glFrustum");
	qglGenLists                 = dllGenLists					= (decltype(dllGenLists				))QGL_GetProcAddress("glGenLists");
	qglGenTextures              = dllGenTextures				= (decltype(dllGenTextures			))QGL_GetProcAddress("glGenTextures");
	qglGetBooleanv              = dllGetBooleanv				= (decltype(dllGetBooleanv			))QGL_GetProcAddress("glGetBooleanv");
	qglGetClipPlane             = dllGetClipPlane				= (decltype(dllGetClipPlane			))QGL_GetProcAddress("glGetClipPlane");
	qglGetDoublev               = dllGetDoublev					= (decltype(dllGetDoublev				))QGL_GetProcAddress("glGetDoublev");
	qglGetError                 = dllGetError					= (decltype(dllGetError				))QGL_GetProcAddress("glGetError");
	qglGetFloatv                = dllGetFloatv					= (decltype(dllGetFloatv				))QGL_GetProcAddress("glGetFloatv");
	qglGetIntegerv              = dllGetIntegerv				= (decltype(dllGetIntegerv			))QGL_GetProcAddress("glGetIntegerv");
	qglGetLightfv               = dllGetLightfv					= (decltype(dllGetLightfv				))QGL_GetProcAddress("glGetLightfv");
	qglGetLightiv               = dllGetLightiv					= (decltype(dllGetLightiv				))QGL_GetProcAddress("glGetLightiv");
	qglGetMapdv                 = dllGetMapdv					= (decltype(dllGetMapdv				))QGL_GetProcAddress("glGetMapdv");
	qglGetMapfv                 = dllGetMapfv					= (decltype(dllGetMapfv				))QGL_GetProcAddress("glGetMapfv");
	qglGetMapiv                 = dllGetMapiv					= (decltype(dllGetMapiv				))QGL_GetProcAddress("glGetMapiv");
	qglGetMaterialfv            = dllGetMaterialfv				= (decltype(dllGetMaterialfv			))QGL_GetProcAddress("glGetMaterialfv");
	qglGetMaterialiv            = dllGetMaterialiv				= (decltype(dllGetMaterialiv			))QGL_GetProcAddress("glGetMaterialiv");
	qglGetPixelMapfv			= dllGetPixelMapfv				= (decltype(dllGetPixelMapfv			))QGL_GetProcAddress("glGetPixelMapfv");
	qglGetPixelMapuiv           = dllGetPixelMapuiv				= (decltype(dllGetPixelMapuiv			))QGL_GetProcAddress("glGetPixelMapuiv");
	qglGetPixelMapusv           = dllGetPixelMapusv				= (decltype(dllGetPixelMapusv			))QGL_GetProcAddress("glGetPixelMapusv");
	qglGetPointerv              = dllGetPointerv				= (decltype(dllGetPointerv			))QGL_GetProcAddress("glGetPointerv");
	qglGetPolygonStipple        = dllGetPolygonStipple			= (decltype(dllGetPolygonStipple		))QGL_GetProcAddress("glGetPolygonStipple");
	qglGetString                = dllGetString					= (decltype(dllGetString				))QGL_GetProcAddress("glGetString");
	qglGetTexEnvfv              = dllGetTexEnvfv				= (decltype(dllGetTexEnvfv			))QGL_GetProcAddress("glGetTexEnvfv");
	qglGetTexEnviv              = dllGetTexEnviv				= (decltype(dllGetTexEnviv			))QGL_GetProcAddress("glGetTexEnviv");
	qglGetTexGendv              = dllGetTexGendv				= (decltype(dllGetTexGendv			))QGL_GetProcAddress("glGetTexGendv");
	qglGetTexGenfv              = dllGetTexGenfv				= (decltype(dllGetTexGenfv			))QGL_GetProcAddress("glGetTexGenfv");
	qglGetTexGeniv              = dllGetTexGeniv				= (decltype(dllGetTexGeniv			))QGL_GetProcAddress("glGetTexGeniv");
	qglGetTexImage              = dllGetTexImage				= (decltype(dllGetTexImage			))QGL_GetProcAddress("glGetTexImage");
	qglGetTexLevelParameterfv   = dllGetTexLevelParameterfv		= (decltype(dllGetTexLevelParameterfv	))QGL_GetProcAddress("glGetTexLevelParameterfv");
	qglGetTexLevelParameteriv   = dllGetTexLevelParameteriv		= (decltype(dllGetTexLevelParameteriv	))QGL_GetProcAddress("glGetTexLevelParameteriv");
	qglGetTexParameterfv        = dllGetTexParameterfv			= (decltype(dllGetTexParameterfv		))QGL_GetProcAddress("glGetTexParameterfv");
	qglGetTexParameteriv        = dllGetTexParameteriv			= (decltype(dllGetTexParameteriv		))QGL_GetProcAddress("glGetTexParameteriv");
	qglHint                     = dllHint						= (decltype(dllHint					))QGL_GetProcAddress("glHint");
	qglIndexMask                = dllIndexMask					= (decltype(dllIndexMask				))QGL_GetProcAddress("glIndexMask");
	qglIndexPointer             = dllIndexPointer				= (decltype(dllIndexPointer			))QGL_GetProcAddress("glIndexPointer");
	qglIndexd                   = dllIndexd						= (decltype(dllIndexd					))QGL_GetProcAddress("glIndexd");
	qglIndexdv                  = dllIndexdv					= (decltype(dllIndexdv				))QGL_GetProcAddress("glIndexdv");
	qglIndexf                   = dllIndexf						= (decltype(dllIndexf					))QGL_GetProcAddress("glIndexf");
	qglIndexfv                  = dllIndexfv					= (decltype(dllIndexfv				))QGL_GetProcAddress("glIndexfv");
	qglIndexi                   = dllIndexi						= (decltype(dllIndexi					))QGL_GetProcAddress("glIndexi");
	qglIndexiv                  = dllIndexiv					= (decltype(dllIndexiv				))QGL_GetProcAddress("glIndexiv");
	qglIndexs                   = dllIndexs						= (decltype(dllIndexs					))QGL_GetProcAddress("glIndexs");
	qglIndexsv                  = dllIndexsv					= (decltype(dllIndexsv				))QGL_GetProcAddress("glIndexsv");
	qglIndexub                  = dllIndexub					= (decltype(dllIndexub				))QGL_GetProcAddress("glIndexub");
	qglIndexubv                 = dllIndexubv					= (decltype(dllIndexubv				))QGL_GetProcAddress("glIndexubv");
	qglInitNames                = dllInitNames					= (decltype(dllInitNames				))QGL_GetProcAddress("glInitNames");
	qglInterleavedArrays        = dllInterleavedArrays			= (decltype(dllInterleavedArrays		))QGL_GetProcAddress("glInterleavedArrays");
	qglIsEnabled                = dllIsEnabled					= (decltype(dllIsEnabled				))QGL_GetProcAddress("glIsEnabled");
	qglIsList                   = dllIsList						= (decltype(dllIsList					))QGL_GetProcAddress("glIsList");
	qglIsTexture                = dllIsTexture					= (decltype(dllIsTexture				))QGL_GetProcAddress("glIsTexture");
	qglLightModelf              = dllLightModelf				= (decltype(dllLightModelf			))QGL_GetProcAddress("glLightModelf");
	qglLightModelfv             = dllLightModelfv				= (decltype(dllLightModelfv			))QGL_GetProcAddress("glLightModelfv");
	qglLightModeli              = dllLightModeli				= (decltype(dllLightModeli			))QGL_GetProcAddress("glLightModeli");
	qglLightModeliv             = dllLightModeliv				= (decltype(dllLightModeliv			))QGL_GetProcAddress("glLightModeliv");
	qglLightf                   = dllLightf						= (decltype(dllLightf					))QGL_GetProcAddress("glLightf");
	qglLightfv                  = dllLightfv					= (decltype(dllLightfv				))QGL_GetProcAddress("glLightfv");
	qglLighti                   = dllLighti						= (decltype(dllLighti					))QGL_GetProcAddress("glLighti");
	qglLightiv                  = dllLightiv					= (decltype(dllLightiv				))QGL_GetProcAddress("glLightiv");
	qglLineStipple              = dllLineStipple				= (decltype(dllLineStipple			))QGL_GetProcAddress("glLineStipple");
	qglLineWidth                = dllLineWidth					= (decltype(dllLineWidth				))QGL_GetProcAddress("glLineWidth");
	qglListBase                 = dllListBase					= (decltype(dllListBase				))QGL_GetProcAddress("glListBase");
	qglLoadIdentity             = dllLoadIdentity				= (decltype(dllLoadIdentity			))QGL_GetProcAddress("glLoadIdentity");
	qglLoadMatrixd              = dllLoadMatrixd				= (decltype(dllLoadMatrixd			))QGL_GetProcAddress("glLoadMatrixd");
	qglLoadMatrixf              = dllLoadMatrixf				= (decltype(dllLoadMatrixf			))QGL_GetProcAddress("glLoadMatrixf");
	qglLoadName                 = dllLoadName					= (decltype(dllLoadName				))QGL_GetProcAddress("glLoadName");
	qglLogicOp                  = dllLogicOp					= (decltype(dllLogicOp				))QGL_GetProcAddress("glLogicOp");
	qglMap1d                    = dllMap1d						= (decltype(dllMap1d					))QGL_GetProcAddress("glMap1d");
	qglMap1f                    = dllMap1f						= (decltype(dllMap1f					))QGL_GetProcAddress("glMap1f");
	qglMap2d                    = dllMap2d						= (decltype(dllMap2d					))QGL_GetProcAddress("glMap2d");
	qglMap2f                    = dllMap2f						= (decltype(dllMap2f					))QGL_GetProcAddress("glMap2f");
	qglMapGrid1d                = dllMapGrid1d					= (decltype(dllMapGrid1d				))QGL_GetProcAddress("glMapGrid1d");
	qglMapGrid1f                = dllMapGrid1f					= (decltype(dllMapGrid1f				))QGL_GetProcAddress("glMapGrid1f");
	qglMapGrid2d                = dllMapGrid2d					= (decltype(dllMapGrid2d				))QGL_GetProcAddress("glMapGrid2d");
	qglMapGrid2f                = dllMapGrid2f					= (decltype(dllMapGrid2f				))QGL_GetProcAddress("glMapGrid2f");
	qglMaterialf                = dllMaterialf					= (decltype(dllMaterialf				))QGL_GetProcAddress("glMaterialf");
	qglMaterialfv               = dllMaterialfv					= (decltype(dllMaterialfv				))QGL_GetProcAddress("glMaterialfv");
	qglMateriali                = dllMateriali					= (decltype(dllMateriali				))QGL_GetProcAddress("glMateriali");
	qglMaterialiv               = dllMaterialiv					= (decltype(dllMaterialiv				))QGL_GetProcAddress("glMaterialiv");
	qglMatrixMode               = dllMatrixMode					= (decltype(dllMatrixMode				))QGL_GetProcAddress("glMatrixMode");
	qglMultMatrixd              = dllMultMatrixd				= (decltype(dllMultMatrixd			))QGL_GetProcAddress("glMultMatrixd");
	qglMultMatrixf              = dllMultMatrixf				= (decltype(dllMultMatrixf			))QGL_GetProcAddress("glMultMatrixf");
	qglNewList                  = dllNewList					= (decltype(dllNewList				))QGL_GetProcAddress("glNewList");
	qglNormal3b                 = dllNormal3b					= (decltype(dllNormal3b				))QGL_GetProcAddress("glNormal3b");
	qglNormal3bv                = dllNormal3bv					= (decltype(dllNormal3bv				))QGL_GetProcAddress("glNormal3bv");
	qglNormal3d                 = dllNormal3d					= (decltype(dllNormal3d				))QGL_GetProcAddress("glNormal3d");
	qglNormal3dv                = dllNormal3dv					= (decltype(dllNormal3dv				))QGL_GetProcAddress("glNormal3dv");
	qglNormal3f                 = dllNormal3f					= (decltype(dllNormal3f				))QGL_GetProcAddress("glNormal3f");
	qglNormal3fv                = dllNormal3fv					= (decltype(dllNormal3fv				))QGL_GetProcAddress("glNormal3fv");
	qglNormal3i                 = dllNormal3i					= (decltype(dllNormal3i				))QGL_GetProcAddress("glNormal3i");
	qglNormal3iv                = dllNormal3iv					= (decltype(dllNormal3iv				))QGL_GetProcAddress("glNormal3iv");
	qglNormal3s                 = dllNormal3s					= (decltype(dllNormal3s				))QGL_GetProcAddress("glNormal3s");
	qglNormal3sv                = dllNormal3sv					= (decltype(dllNormal3sv				))QGL_GetProcAddress("glNormal3sv");
	qglNormalPointer            = dllNormalPointer				= (decltype(dllNormalPointer			))QGL_GetProcAddress("glNormalPointer");
	qglOrtho                    = dllOrtho						= (decltype(dllOrtho					))QGL_GetProcAddress("glOrtho");
	qglPassThrough              = dllPassThrough				= (decltype(dllPassThrough			))QGL_GetProcAddress("glPassThrough");
	qglPixelMapfv               = dllPixelMapfv					= (decltype(dllPixelMapfv				))QGL_GetProcAddress("glPixelMapfv");
	qglPixelMapuiv              = dllPixelMapuiv				= (decltype(dllPixelMapuiv			))QGL_GetProcAddress("glPixelMapuiv");
	qglPixelMapusv              = dllPixelMapusv				= (decltype(dllPixelMapusv			))QGL_GetProcAddress("glPixelMapusv");
	qglPixelStoref              = dllPixelStoref				= (decltype(dllPixelStoref			))QGL_GetProcAddress("glPixelStoref");
	qglPixelStorei              = dllPixelStorei				= (decltype(dllPixelStorei			))QGL_GetProcAddress("glPixelStorei");
	qglPixelTransferf           = dllPixelTransferf				= (decltype(dllPixelTransferf			))QGL_GetProcAddress("glPixelTransferf");
	qglPixelTransferi           = dllPixelTransferi				= (decltype(dllPixelTransferi			))QGL_GetProcAddress("glPixelTransferi");
	qglPixelZoom                = dllPixelZoom					= (decltype(dllPixelZoom				))QGL_GetProcAddress("glPixelZoom");
	qglPointSize                = dllPointSize					= (decltype(dllPointSize				))QGL_GetProcAddress("glPointSize");
	qglPolygonMode              = dllPolygonMode				= (decltype(dllPolygonMode			))QGL_GetProcAddress("glPolygonMode");
	qglPolygonOffset            = dllPolygonOffset				= (decltype(dllPolygonOffset			))QGL_GetProcAddress("glPolygonOffset");
	qglPolygonStipple           = dllPolygonStipple				= (decltype(dllPolygonStipple			))QGL_GetProcAddress("glPolygonStipple");
	qglPopAttrib                = dllPopAttrib					= (decltype(dllPopAttrib				))QGL_GetProcAddress("glPopAttrib");
	qglPopClientAttrib          = dllPopClientAttrib			= (decltype(dllPopClientAttrib		))QGL_GetProcAddress("glPopClientAttrib");
	qglPopMatrix                = dllPopMatrix					= (decltype(dllPopMatrix				))QGL_GetProcAddress("glPopMatrix");
	qglPopName                  = dllPopName					= (decltype(dllPopName				))QGL_GetProcAddress("glPopName");
	qglPrioritizeTextures       = dllPrioritizeTextures			= (decltype(dllPrioritizeTextures		))QGL_GetProcAddress("glPrioritizeTextures");
	qglPushAttrib               = dllPushAttrib					= (decltype(dllPushAttrib				))QGL_GetProcAddress("glPushAttrib");
	qglPushClientAttrib         = dllPushClientAttrib			= (decltype(dllPushClientAttrib		))QGL_GetProcAddress("glPushClientAttrib");
	qglPushMatrix               = dllPushMatrix					= (decltype(dllPushMatrix				))QGL_GetProcAddress("glPushMatrix");
	qglPushName                 = dllPushName					= (decltype(dllPushName				))QGL_GetProcAddress("glPushName");
	qglRasterPos2d              = dllRasterPos2d				= (decltype(dllRasterPos2d			))QGL_GetProcAddress("glRasterPos2d");
	qglRasterPos2dv             = dllRasterPos2dv				= (decltype(dllRasterPos2dv			))QGL_GetProcAddress("glRasterPos2dv");
	qglRasterPos2f              = dllRasterPos2f				= (decltype(dllRasterPos2f			))QGL_GetProcAddress("glRasterPos2f");
	qglRasterPos2fv             = dllRasterPos2fv				= (decltype(dllRasterPos2fv			))QGL_GetProcAddress("glRasterPos2fv");
	qglRasterPos2i              = dllRasterPos2i				= (decltype(dllRasterPos2i			))QGL_GetProcAddress("glRasterPos2i");
	qglRasterPos2iv             = dllRasterPos2iv				= (decltype(dllRasterPos2iv			))QGL_GetProcAddress("glRasterPos2iv");
	qglRasterPos2s              = dllRasterPos2s				= (decltype(dllRasterPos2s			))QGL_GetProcAddress("glRasterPos2s");
	qglRasterPos2sv             = dllRasterPos2sv				= (decltype(dllRasterPos2sv			))QGL_GetProcAddress("glRasterPos2sv");
	qglRasterPos3d              = dllRasterPos3d				= (decltype(dllRasterPos3d			))QGL_GetProcAddress("glRasterPos3d");
	qglRasterPos3dv             = dllRasterPos3dv				= (decltype(dllRasterPos3dv			))QGL_GetProcAddress("glRasterPos3dv");
	qglRasterPos3f              = dllRasterPos3f				= (decltype(dllRasterPos3f			))QGL_GetProcAddress("glRasterPos3f");
	qglRasterPos3fv             = dllRasterPos3fv				= (decltype(dllRasterPos3fv			))QGL_GetProcAddress("glRasterPos3fv");
	qglRasterPos3i              = dllRasterPos3i				= (decltype(dllRasterPos3i			))QGL_GetProcAddress("glRasterPos3i");
	qglRasterPos3iv             = dllRasterPos3iv				= (decltype(dllRasterPos3iv			))QGL_GetProcAddress("glRasterPos3iv");
	qglRasterPos3s              = dllRasterPos3s				= (decltype(dllRasterPos3s			))QGL_GetProcAddress("glRasterPos3s");
	qglRasterPos3sv             = dllRasterPos3sv				= (decltype(dllRasterPos3sv			))QGL_GetProcAddress("glRasterPos3sv");
	qglRasterPos4d              = dllRasterPos4d				= (decltype(dllRasterPos4d			))QGL_GetProcAddress("glRasterPos4d");
	qglRasterPos4dv             = dllRasterPos4dv				= (decltype(dllRasterPos4dv			))QGL_GetProcAddress("glRasterPos4dv");
	qglRasterPos4f              = dllRasterPos4f				= (decltype(dllRasterPos4f			))QGL_GetProcAddress("glRasterPos4f");
	qglRasterPos4fv             = dllRasterPos4fv				= (decltype(dllRasterPos4fv			))QGL_GetProcAddress("glRasterPos4fv");
	qglRasterPos4i              = dllRasterPos4i				= (decltype(dllRasterPos4i			))QGL_GetProcAddress("glRasterPos4i");
	qglRasterPos4iv             = dllRasterPos4iv				= (decltype(dllRasterPos4iv			))QGL_GetProcAddress("glRasterPos4iv");
	qglRasterPos4s              = dllRasterPos4s				= (decltype(dllRasterPos4s			))QGL_GetProcAddress("glRasterPos4s");
	qglRasterPos4sv             = dllRasterPos4sv				= (decltype(dllRasterPos4sv			))QGL_GetProcAddress("glRasterPos4sv");
	qglReadBuffer               = dllReadBuffer					= (decltype(dllReadBuffer				))QGL_GetProcAddress("glReadBuffer");
	qglReadPixels               = dllReadPixels					= (decltype(dllReadPixels				))QGL_GetProcAddress("glReadPixels");
	qglRectd                    = dllRectd						= (decltype(dllRectd					))QGL_GetProcAddress("glRectd");
	qglRectdv                   = dllRectdv						= (decltype(dllRectdv					))QGL_GetProcAddress("glRectdv");
	qglRectf                    = dllRectf						= (decltype(dllRectf					))QGL_GetProcAddress("glRectf");
	qglRectfv                   = dllRectfv						= (decltype(dllRectfv					))QGL_GetProcAddress("glRectfv");
	qglRecti                    = dllRecti						= (decltype(dllRecti					))QGL_GetProcAddress("glRecti");
	qglRectiv                   = dllRectiv						= (decltype(dllRectiv					))QGL_GetProcAddress("glRectiv");
	qglRects                    = dllRects						= (decltype(dllRects					))QGL_GetProcAddress("glRects");
	qglRectsv                   = dllRectsv						= (decltype(dllRectsv					))QGL_GetProcAddress("glRectsv");
	qglRenderMode               = dllRenderMode					= (decltype(dllRenderMode				))QGL_GetProcAddress("glRenderMode");
	qglRotated                  = dllRotated					= (decltype(dllRotated				))QGL_GetProcAddress("glRotated");
	qglRotatef                  = dllRotatef					= (decltype(dllRotatef				))QGL_GetProcAddress("glRotatef");
	qglScaled                   = dllScaled						= (decltype(dllScaled					))QGL_GetProcAddress("glScaled");
	qglScalef                   = dllScalef						= (decltype(dllScalef					))QGL_GetProcAddress("glScalef");
	qglScissor                  = dllScissor					= (decltype(dllScissor				))QGL_GetProcAddress("glScissor");
	qglSelectBuffer             = dllSelectBuffer				= (decltype(dllSelectBuffer			))QGL_GetProcAddress("glSelectBuffer");
	qglShadeModel               = dllShadeModel					= (decltype(dllShadeModel				))QGL_GetProcAddress("glShadeModel");
	qglStencilFunc              = dllStencilFunc				= (decltype(dllStencilFunc			))QGL_GetProcAddress("glStencilFunc");
	qglStencilMask              = dllStencilMask				= (decltype(dllStencilMask			))QGL_GetProcAddress("glStencilMask");
	qglStencilOp                = dllStencilOp					= (decltype(dllStencilOp				))QGL_GetProcAddress("glStencilOp");
	qglTexCoord1d               = dllTexCoord1d					= (decltype(dllTexCoord1d				))QGL_GetProcAddress("glTexCoord1d");
	qglTexCoord1dv              = dllTexCoord1dv				= (decltype(dllTexCoord1dv			))QGL_GetProcAddress("glTexCoord1dv");
	qglTexCoord1f               = dllTexCoord1f					= (decltype(dllTexCoord1f				))QGL_GetProcAddress("glTexCoord1f");
	qglTexCoord1fv              = dllTexCoord1fv				= (decltype(dllTexCoord1fv			))QGL_GetProcAddress("glTexCoord1fv");
	qglTexCoord1i               = dllTexCoord1i					= (decltype(dllTexCoord1i				))QGL_GetProcAddress("glTexCoord1i");
	qglTexCoord1iv              = dllTexCoord1iv				= (decltype(dllTexCoord1iv			))QGL_GetProcAddress("glTexCoord1iv");
	qglTexCoord1s               = dllTexCoord1s					= (decltype(dllTexCoord1s				))QGL_GetProcAddress("glTexCoord1s");
	qglTexCoord1sv              = dllTexCoord1sv				= (decltype(dllTexCoord1sv			))QGL_GetProcAddress("glTexCoord1sv");
	qglTexCoord2d               = dllTexCoord2d					= (decltype(dllTexCoord2d				))QGL_GetProcAddress("glTexCoord2d");
	qglTexCoord2dv              = dllTexCoord2dv				= (decltype(dllTexCoord2dv			))QGL_GetProcAddress("glTexCoord2dv");
	qglTexCoord2f               = dllTexCoord2f					= (decltype(dllTexCoord2f				))QGL_GetProcAddress("glTexCoord2f");
	qglTexCoord2fv              = dllTexCoord2fv				= (decltype(dllTexCoord2fv			))QGL_GetProcAddress("glTexCoord2fv");
	qglTexCoord2i               = dllTexCoord2i					= (decltype(dllTexCoord2i				))QGL_GetProcAddress("glTexCoord2i");
	qglTexCoord2iv              = dllTexCoord2iv				= (decltype(dllTexCoord2iv			))QGL_GetProcAddress("glTexCoord2iv");
	qglTexCoord2s               = dllTexCoord2s					= (decltype(dllTexCoord2s				))QGL_GetProcAddress("glTexCoord2s");
	qglTexCoord2sv              = dllTexCoord2sv				= (decltype(dllTexCoord2sv			))QGL_GetProcAddress("glTexCoord2sv");
	qglTexCoord3d               = dllTexCoord3d					= (decltype(dllTexCoord3d				))QGL_GetProcAddress("glTexCoord3d");
	qglTexCoord3dv              = dllTexCoord3dv				= (decltype(dllTexCoord3dv			))QGL_GetProcAddress("glTexCoord3dv");
	qglTexCoord3f               = dllTexCoord3f					= (decltype(dllTexCoord3f				))QGL_GetProcAddress("glTexCoord3f");
	qglTexCoord3fv              = dllTexCoord3fv				= (decltype(dllTexCoord3fv			))QGL_GetProcAddress("glTexCoord3fv");
	qglTexCoord3i               = dllTexCoord3i					= (decltype(dllTexCoord3i				))QGL_GetProcAddress("glTexCoord3i");
	qglTexCoord3iv              = dllTexCoord3iv				= (decltype(dllTexCoord3iv			))QGL_GetProcAddress("glTexCoord3iv");
	qglTexCoord3s               = dllTexCoord3s					= (decltype(dllTexCoord3s				))QGL_GetProcAddress("glTexCoord3s");
	qglTexCoord3sv              = dllTexCoord3sv				= (decltype(dllTexCoord3sv			))QGL_GetProcAddress("glTexCoord3sv");
	qglTexCoord4d               = dllTexCoord4d					= (decltype(dllTexCoord4d				))QGL_GetProcAddress("glTexCoord4d");
	qglTexCoord4dv              = dllTexCoord4dv				= (decltype(dllTexCoord4dv			))QGL_GetProcAddress("glTexCoord4dv");
	qglTexCoord4f               = dllTexCoord4f					= (decltype(dllTexCoord4f				))QGL_GetProcAddress("glTexCoord4f");
	qglTexCoord4fv              = dllTexCoord4fv				= (decltype(dllTexCoord4fv			))QGL_GetProcAddress("glTexCoord4fv");
	qglTexCoord4i               = dllTexCoord4i					= (decltype(dllTexCoord4i				))QGL_GetProcAddress("glTexCoord4i");
	qglTexCoord4iv              = dllTexCoord4iv				= (decltype(dllTexCoord4iv			))QGL_GetProcAddress("glTexCoord4iv");
	qglTexCoord4s               = dllTexCoord4s					= (decltype(dllTexCoord4s				))QGL_GetProcAddress("glTexCoord4s");
	qglTexCoord4sv              = dllTexCoord4sv				= (decltype(dllTexCoord4sv			))QGL_GetProcAddress("glTexCoord4sv");
	qglTexCoordPointer          = dllTexCoordPointer			= (decltype(dllTexCoordPointer		))QGL_GetProcAddress("glTexCoordPointer");
	qglTexEnvf                  = dllTexEnvf					= (decltype(dllTexEnvf				))QGL_GetProcAddress("glTexEnvf");
	qglTexEnvfv                 = dllTexEnvfv					= (decltype(dllTexEnvfv				))QGL_GetProcAddress("glTexEnvfv");
	qglTexEnvi                  = dllTexEnvi					= (decltype(dllTexEnvi				))QGL_GetProcAddress("glTexEnvi");
	qglTexEnviv                 = dllTexEnviv					= (decltype(dllTexEnviv				))QGL_GetProcAddress("glTexEnviv");
	qglTexGend                  = dllTexGend					= (decltype(dllTexGend				))QGL_GetProcAddress("glTexGend");
	qglTexGendv                 = dllTexGendv					= (decltype(dllTexGendv				))QGL_GetProcAddress("glTexGendv");
	qglTexGenf                  = dllTexGenf					= (decltype(dllTexGenf				))QGL_GetProcAddress("glTexGenf");
	qglTexGenfv                 = dllTexGenfv					= (decltype(dllTexGenfv				))QGL_GetProcAddress("glTexGenfv");
	qglTexGeni                  = dllTexGeni					= (decltype(dllTexGeni				))QGL_GetProcAddress("glTexGeni");
	qglTexGeniv                 = dllTexGeniv					= (decltype(dllTexGeniv				))QGL_GetProcAddress("glTexGeniv");
	qglTexImage1D               = dllTexImage1D					= (decltype(dllTexImage1D				))QGL_GetProcAddress("glTexImage1D");
	qglTexImage2D               = dllTexImage2D					= (decltype(dllTexImage2D				))QGL_GetProcAddress("glTexImage2D");
	qglTexParameterf            = dllTexParameterf				= (decltype(dllTexParameterf			))QGL_GetProcAddress("glTexParameterf");
	qglTexParameterfv           = dllTexParameterfv				= (decltype(dllTexParameterfv			))QGL_GetProcAddress("glTexParameterfv");
	qglTexParameteri            = dllTexParameteri				= (decltype(dllTexParameteri			))QGL_GetProcAddress("glTexParameteri");
	qglTexParameteriv           = dllTexParameteriv				= (decltype(dllTexParameteriv			))QGL_GetProcAddress("glTexParameteriv");
	qglTexSubImage1D            = dllTexSubImage1D				= (decltype(dllTexSubImage1D			))QGL_GetProcAddress("glTexSubImage1D");
	qglTexSubImage2D            = dllTexSubImage2D				= (decltype(dllTexSubImage2D			))QGL_GetProcAddress("glTexSubImage2D");
	qglTranslated               = dllTranslated					= (decltype(dllTranslated				))QGL_GetProcAddress("glTranslated");
	qglTranslatef               = dllTranslatef					= (decltype(dllTranslatef				))QGL_GetProcAddress("glTranslatef");
	qglVertex2d                 = dllVertex2d					= (decltype(dllVertex2d				))QGL_GetProcAddress("glVertex2d");
	qglVertex2dv                = dllVertex2dv					= (decltype(dllVertex2dv				))QGL_GetProcAddress("glVertex2dv");
	qglVertex2f                 = dllVertex2f					= (decltype(dllVertex2f				))QGL_GetProcAddress("glVertex2f");
	qglVertex2fv                = dllVertex2fv					= (decltype(dllVertex2fv				))QGL_GetProcAddress("glVertex2fv");
	qglVertex2i                 = dllVertex2i					= (decltype(dllVertex2i				))QGL_GetProcAddress("glVertex2i");
	qglVertex2iv                = dllVertex2iv					= (decltype(dllVertex2iv				))QGL_GetProcAddress("glVertex2iv");
	qglVertex2s                 = dllVertex2s					= (decltype(dllVertex2s				))QGL_GetProcAddress("glVertex2s");
	qglVertex2sv                = dllVertex2sv					= (decltype(dllVertex2sv				))QGL_GetProcAddress("glVertex2sv");
	qglVertex3d                 = dllVertex3d					= (decltype(dllVertex3d				))QGL_GetProcAddress("glVertex3d");
	qglVertex3dv                = dllVertex3dv					= (decltype(dllVertex3dv				))QGL_GetProcAddress("glVertex3dv");
	qglVertex3f                 = dllVertex3f					= (decltype(dllVertex3f				))QGL_GetProcAddress("glVertex3f");
	qglVertex3fv                = dllVertex3fv					= (decltype(dllVertex3fv				))QGL_GetProcAddress("glVertex3fv");
	qglVertex3i                 = dllVertex3i					= (decltype(dllVertex3i				))QGL_GetProcAddress("glVertex3i");
	qglVertex3iv                = dllVertex3iv					= (decltype(dllVertex3iv				))QGL_GetProcAddress("glVertex3iv");
	qglVertex3s                 = dllVertex3s					= (decltype(dllVertex3s				))QGL_GetProcAddress("glVertex3s");
	qglVertex3sv                = dllVertex3sv					= (decltype(dllVertex3sv				))QGL_GetProcAddress("glVertex3sv");
	qglVertex4d                 = dllVertex4d					= (decltype(dllVertex4d				))QGL_GetProcAddress("glVertex4d");
	qglVertex4dv                = dllVertex4dv					= (decltype(dllVertex4dv				))QGL_GetProcAddress("glVertex4dv");
	qglVertex4f                 = dllVertex4f					= (decltype(dllVertex4f				))QGL_GetProcAddress("glVertex4f");
	qglVertex4fv                = dllVertex4fv					= (decltype(dllVertex4fv				))QGL_GetProcAddress("glVertex4fv");
	qglVertex4i                 = dllVertex4i					= (decltype(dllVertex4i				))QGL_GetProcAddress("glVertex4i");
	qglVertex4iv                = dllVertex4iv					= (decltype(dllVertex4iv				))QGL_GetProcAddress("glVertex4iv");
	qglVertex4s                 = dllVertex4s					= (decltype(dllVertex4s				))QGL_GetProcAddress("glVertex4s");
	qglVertex4sv                = dllVertex4sv					= (decltype(dllVertex4sv				))QGL_GetProcAddress("glVertex4sv");
	qglVertexPointer            = dllVertexPointer				= (decltype(dllVertexPointer			))QGL_GetProcAddress("glVertexPointer");
	qglViewport                 = dllViewport					= (decltype(dllViewport				))QGL_GetProcAddress("glViewport");

	qglActiveTextureARB					= dllActiveTextureARB				= NULL;
	qglClientActiveTextureARB			= dllClientActiveTextureARB			= NULL;

	qglBindBufferARB					= dllBindBufferARB					= NULL;
	qglDeleteBuffersARB					= dllDeleteBuffersARB				= NULL;
	qglGenBuffersARB					= dllGenBuffersARB					= NULL;
	qglBufferDataARB					= dllBufferDataARB					= NULL;
	qglBufferSubDataARB					= dllBufferSubDataARB				= NULL;
	qglMapBufferARB						= dllMapBufferARB					= NULL;
	qglUnmapBufferARB					= dllUnmapBufferARB					= NULL;

	// TODO: DLL stuff
	qglBindAttribLocationARB			= NULL;
	qglGetActiveAttribARB				= NULL;
	qglGetAttribLocationARB				= NULL;

	qglVertexAttribPointerARB			= NULL;
	qglEnableVertexAttribArrayARB		= NULL;
	qglDisableVertexAttribArrayARB		= NULL;

	qglDeleteObjectARB					= NULL;
	qglGetHandleARB						= NULL;
	qglDetachObjectARB					= NULL;
	qglCreateShaderObjectARB			= NULL;
	qglShaderSourceARB					= NULL;
	qglCompileShaderARB					= NULL;
	qglCreateProgramObjectARB			= NULL;
	qglAttachObjectARB					= NULL;
	qglLinkProgramARB					= NULL;
	qglUseProgramObjectARB				= NULL;
	qglValidateProgramARB				= NULL;
	qglUniform1fARB						= NULL;
	qglUniform2fARB						= NULL;
	qglUniform3fARB						= NULL;
	qglUniform4fARB						= NULL;
	qglUniform1iARB						= NULL;
	qglUniform2iARB						= NULL;
	qglUniform3iARB						= NULL;
	qglUniform4iARB						= NULL;
	qglUniform1fvARB					= NULL;
	qglUniform2fvARB					= NULL;
	qglUniform3fvARB					= NULL;
	qglUniform4fvARB					= NULL;
	qglUniform1ivARB					= NULL;
	qglUniform2ivARB					= NULL;
	qglUniform3ivARB					= NULL;
	qglUniform4ivARB					= NULL;
	qglUniformMatrix2fvARB				= NULL;
	qglUniformMatrix3fvARB				= NULL;
	qglUniformMatrix4fvARB				= NULL;
	qglGetObjectParameterfvARB			= NULL;
	qglGetObjectParameterivARB			= NULL;
	qglGetInfoLogARB					= NULL;
	qglGetAttachedObjectsARB			= NULL;
	qglGetUniformLocationARB			= NULL;
	qglGetActiveUniformARB				= NULL;
	qglGetUniformfvARB					= NULL;
	qglGetUniformivARB					= NULL;
	qglGetShaderSourceARB				= NULL;

	qglActiveStencilFaceEXT				= dllActiveStencilFaceEXT			= NULL;

	qglStencilOpSeparateATI				= dllStencilOpSeparateATI			= NULL;
	qglStencilFuncSeparateATI			= dllStencilFuncSeparateATI			= NULL;

	qglDepthBoundsEXT					= dllDepthBoundsEXT					= NULL;

#include "../ref_gl/qgl2.h"

#undef QGL_WGL_EXT
#undef QGL_WGL
#undef QGL_EXT
#undef QGL_FUNC

	return true;
}

void *qglGetProcAddress( const char *procName )
{
	return (void *)qwglGetProcAddress(procName );
}

void QGL_EnableLogging2 (bool enable){
}

void QGL_LogPrintf2 (const char *fmt, ...){

	va_list	argPtr;

	if (!glwState.logFile)
		return;

	va_start(argPtr, fmt);
	vfprintf(glwState.logFile, fmt, argPtr);
	va_end(argPtr);
}